package com.unbox.admin.fegin;

import com.unbox.admin.entity.CLog;
import com.unbox.admin.hystrix.CLogHystrix;
import com.unbox.common.configuration.fegin.FeignRequestInterceptor;
import com.unbox.common.response.UnboxResponse;
import com.unbox.common.table.UnBoxPage;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * <p>
    * <日志管理业务熔断配置
        * </p>
 *
 * @author 王振宇
 * @since 2021-04-08
 */
@FeignClient(value = "admin-service" , configuration = FeignRequestInterceptor.class, fallback = CLogHystrix.class)
public interface LogFegin {

    /**
     * 分页查询
     * @param log
     * @param pageNo
     * @param pageSize
     * @return
     */
    @GetMapping(value = "/v1/log/getPageList", consumes = MediaType.APPLICATION_JSON_VALUE)
    UnboxResponse<UnBoxPage> getPageList(@SpringQueryMap CLog log, @RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize);

    /**
     * 详情
     *
     * @param log
     * @return
     */
    @GetMapping(value = "/v1/log/info", consumes = MediaType.APPLICATION_JSON_VALUE)
    UnboxResponse<CLog> info(@SpringQueryMap CLog log);

    /**
     * 通过id数据查询数据
     *
     * @param ids
     * @return
     */
    @GetMapping(path = "/v1/log/idsLogs", consumes = MediaType.APPLICATION_JSON_VALUE)
    UnboxResponse<List<CLog>> idsLogs(@SpringQueryMap List<Integer> ids);

    /**
     * 保存数据
     *
     * @param log
     * @return
     */
    @PostMapping("/v1/log/save")
    UnboxResponse<Boolean> save(@RequestBody CLog log);

    /**
     * 批量添加
     *
     * @param logs
     * @return
     */
    @PostMapping("/v1/log/saveBatch")
    UnboxResponse<Boolean> batchSave(@RequestBody List<CLog> logs);

    /**
     * 修改数据
     *
     * @param log
     * @return
     */
    @PutMapping("/v1/log/update")
    UnboxResponse<Boolean> update(@RequestBody CLog log);

    /**
     * 批量修改
     *
     * @param logs
     * @return
     */
    @PutMapping("/v1/log/updateBatch")
    UnboxResponse<Boolean> batchUpdate(@RequestBody List<CLog> logs);

    /**
     * 删除数据
     *
     * @param log
     * @return
     */
    @DeleteMapping("/v1/log/delete")
    UnboxResponse<Boolean> delete(@RequestBody CLog log);

    /**
     * 批量删除
     *
     * @param ids
     * @return
     */
    @DeleteMapping("/v1/log/deleteBatch")
    UnboxResponse<Boolean> deleteBatch(@RequestBody List<Integer> ids);

}
